package com.mdw.xxl.job.task;

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import cn.hutool.http.Header;
import cn.hutool.http.Method;


import java.util.HashMap;
import java.util.Map;

public class HttpExample {

    public static void main(String[] args) {
        // 创建 HttpRequest 对象并设置请求方法为 POST
        HttpRequest post = HttpRequest.post("http://152.168.162.10:8389/xxl-job-admin/jobinfo/trigger");

        // 设置请求头

        post.header(Header.COOKIE, "XXL_JOB_LOGIN_IDENTITY=7b226964223a312c22757365726e616d65223a2261646d696e222c2270617373776f7264223a226531306164633339343962613539616262653536653035376632306638383365222c22726f6c65223a312c227065726d697373696f6e223a6e756c6c7d; xljs-auth={\"access_token\":\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjo0MDEzMjYwODcxNTMzNTY4LCJvcmdfaWQiOjQ3NjkxODk4NzYxODgxNjAsInVzZXJfbmFtZSI6ImFkbWluIiwic2NvcGUiOlsicmVhZCIsIndyaXRlIiwiYWxsIl0sIm5hbWUiOiLmmbrmhaflm63ljLoiLCJleHAiOjE3MjM3Mzk5MzYsImp0aSI6Ijg1ZDI2NmVjLTFkMDItNDhiNC1hMjczLTIzNGRmNzRkNTdjYiIsImNsaWVudF9pZCI6ImdkYy1kcCJ9.x5RQf3X5MuT-ZdEFYp7WNNgpybMjxJAaX4_TRCnmrIM\",\"token_type\":\"bearer\",\"refresh_token\":\" eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjo0MDEzMjYwODcxNTMzNTY4LCJvcmdfaWQiOjQ3NjkxODk4NzYxODgxNjAsInVzZXJfbmFtZSI6ImFkbWluIiwic2NvcGUiOlsicmVhZCIsIndyaXRlIiwiYWxsIl0sImF0aSI6Ijg1ZDI2NmVjLTFkMDItNDhiNC1hMjczLTIzNGRmNzRkNTdjYiIsIm5hbWUiOiLmmbrmhaflm63ljLoiLCJleHAiOjE3MjQzMDg3MzYsImp0aSI6ImNmOThjOWJmLWExMzktNDg1OS04NmRjLTZlMWIwMjEzNTg0ZSIsImNsaWVudF9pZCI6ImdkYy1kcCJ9.OR_3HuYcArJO1HUHLeJdr8_iflwoO48Bg3ZtEb2N0fY\",\"expires_in\":28879,\" scope\":\"read write all\",\"jti\":\"85d266ec-1d02-48b4-a273-234df74d57cb\"}; NSESSIONID=23734a6a6821dc3ac063a997cdd478d7a15cf81a7b2b0fe6");
        post.header(Header.USER_AGENT, "Apifox/1.0.0 (https://apifox.com)");
        post.header(Header.CONTENT_TYPE, "application/x-www-form-urlencoded; charset=UTF-8");

        // 设置表单数据
        Map<String, Object> formEntity = new HashMap<>();
        formEntity.put("id", "17");
        formEntity.put("executorParam", "");
        formEntity.put("addressList", "");

        // 发送请求
        String result = post.form(formEntity).execute().body();

        // 打印结果
        System.out.println(result);
    }
}
